home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Appearance SDK 1.0.4 / Appearance Sample Code / Source / MegaDialog.cp < prev    next >
Encoding:
Text File  |  1999-07-16  |  2.0 KB  |  119 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MegaDialog.cp
  3.  
  4.     Contains:    Code to drive our MegaDialog example.
  5.  
  6.     Version:    Appearance 1.0 SDK
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                Edward Voas
  13.  
  14.         Other Contact:        7 of 9, Borg Collective
  15.  
  16.         Technology:            OS Technologies Group
  17.  
  18.     Writers:
  19.  
  20.         (edv)    Ed Voas
  21.  
  22.     Change History (most recent first):
  23.  
  24.          <1>     9/11/97    edv        First checked in.
  25. */
  26.  
  27. #include "MegaDialog.h"
  28. #include "Appearance.h"
  29. #include "ProgressPane.h"
  30. #include "SliderPane.h"
  31. #include "ClassicPane.h"
  32. #include "TextPane.h"
  33. #include "LayoutPane.h"
  34. #include "NewButtonPane.h"
  35.  
  36. enum
  37. {
  38.     kNoPane            = 0,
  39.     kClassicPane    = 1,
  40.     kSliderPane        = 2,
  41.     kTextPane         = 3,
  42.     kProgressPane    = 4,
  43.     kLayoutPane        = 5,
  44.     kNewPane        = 6
  45. };
  46.  
  47. MegaDialog::MegaDialog() : BaseDialog( 6000 )
  48. {
  49.     fPane = nil;
  50.     SwitchPane( kClassicPane );
  51. }
  52.  
  53. MegaDialog::~MegaDialog()
  54. {
  55.     delete fPane;
  56. }
  57.  
  58. void
  59. MegaDialog::Idle()
  60. {
  61.     if ( fPane ) fPane->Idle();
  62. }
  63.  
  64. void
  65. MegaDialog::SwitchPane( SInt16 paneIndex )
  66. {
  67.     ControlHandle        control;
  68.  
  69.     if ( paneIndex == 0 ) return;
  70.  
  71.     delete fPane;
  72.     fPane = nil;    
  73.         
  74.     GetDialogItemAsControl( fWindow, 1, &control );
  75.     SetControlValue( control, paneIndex );
  76.  
  77.     switch ( paneIndex )
  78.     {
  79.         case kProgressPane:
  80.             fPane = new ProgressPane( fWindow, CountDITL( fWindow ) );
  81.             break;
  82.  
  83.         case kSliderPane:
  84.             fPane = new SliderPane( fWindow, CountDITL( fWindow ) );
  85.             break;
  86.  
  87.         case kClassicPane:
  88.             fPane = new ClassicPane( fWindow, CountDITL( fWindow ) );
  89.             break;
  90.  
  91.         case kTextPane:
  92.             fPane = new TextPane( fWindow, CountDITL( fWindow ) );
  93.             break;
  94.         
  95.         case kLayoutPane:
  96.             fPane = new LayoutPane( fWindow, CountDITL( fWindow ) );
  97.             break;
  98.         
  99.         case kNewPane:
  100.             fPane = new NewButtonPane( fWindow, CountDITL( fWindow ) );
  101.             break;
  102.     }    
  103. }
  104.  
  105. void
  106. MegaDialog::HandleItemHit( SInt16 item )
  107. {
  108.     if ( item == 1 )
  109.     {
  110.         ControlHandle        control;
  111.         
  112.         GetDialogItemAsControl( fWindow, 1, &control );
  113.         SwitchPane( GetControlValue( control ) );
  114.     }
  115.     else if ( fPane )
  116.     {
  117.         fPane->ItemHit( item );
  118.     }
  119. }